package com.d2rv.vrpn;

import com.d2rv.experience.SceneManager;
import com.d2rv.settings.Settings;

/**
 * Manager of the vrpn client for kinect
 *
 * @author Darrieutort A., Dupouy A., Rossignol L., Van Poucke A.
 */
public class VRPNManager {

    private VRPNClient vrpnclient;
    private boolean headtracking;

    /**
     * Default constructor.
     *
     * @param scenemanager the manager of the scene used to move the user
     */
    public VRPNManager(SceneManager scenemanager) {
        Settings settings = Settings.getInstance();
        this.vrpnclient = new VRPNClient(settings.vrpnip(), scenemanager);
        this.headtracking = false;
    }

    /**
     * Called when an update of the buttons states and trackers positions is
     * needed
     */
    public void updateVRPN() {
        this.vrpnclient.update(this.headtracking);
    }

    /**
     * Uses to activates the head-tracking.
     *
     * @param headtracking activates/desactivates head-tracking
     */
    public void headtracking(boolean headtracking) {
        this.headtracking = headtracking;
    }
}